package com.group.elmboot.controller;

import java.util.List;

import com.group.elmboot.po.Food;
import com.group.elmboot.service.FoodService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.cloud.context.config.annotation.RefreshScope;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
@RefreshScope//开启动态刷新
@RestController
@RequestMapping("/FoodController")
public class FoodController {
	
	@Autowired
	private FoodService foodService;

	@RequestMapping("/listFoodByBusinessId")
	public List<Food> listFoodByBusinessId(Food food) throws Exception{
		return foodService.listFoodByBusinessId(food.getBusinessId());
	}
	
	@RequestMapping("/updateFoodInfoById")
	public int updateFoodInfoById(Food food) throws Exception{
		return foodService.updateFoodInfoById(food);
	}
	
	@RequestMapping("/insertFoodInfo")
	public int insertFoodInfo(Food food) throws Exception{
		return foodService.insertFoodInfo(food);
	}
	
	@RequestMapping("/deleteFoodInfo")
	public int deleteFoodInfo(Food food) throws Exception{
		return foodService.deleteFoodInfo(food.getFoodId());
	}
}
